package com.googlecode.everyidea.core.dao;

import com.googlecode.everyidea.core.model.Role;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class RoleDAOImpl extends SqlMapClientDaoSupport implements RoleDAO {

    /**
     * 
     * This method corresponds to the database table S_ROLE
     *
     * 
     */
    public RoleDAOImpl() {
        super();
    }

    /**
     * 
     * This method corresponds to the database table S_ROLE
     *
     * 
     */
    public void insert(Role record) {
        getSqlMapClientTemplate().insert("S_ROLE.insert", record);
    }

    /**
     * 
     * This method corresponds to the database table S_ROLE
     *
     * 
     */
    public int updateByPrimaryKey(Role record) {
        int rows = getSqlMapClientTemplate().update("S_ROLE.updateByPrimaryKey", record);
        return rows;
    }

    /**
     * 
     * This method corresponds to the database table S_ROLE
     *
     * 
     */
    public int updateByPrimaryKeySelective(Role record) {
        int rows = getSqlMapClientTemplate().update("S_ROLE.updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * 
     * This method corresponds to the database table S_ROLE
     *
     * 
     */
    public Role selectByPrimaryKey(int roleId) {
        Role key = new Role();
        key.setRoleId(roleId);
        Role record = (Role) getSqlMapClientTemplate().queryForObject("S_ROLE.selectByPrimaryKey", key);
        return record;
    }

    /**
     * 
     * This method corresponds to the database table S_ROLE
     *
     * 
     */
    public int deleteByPrimaryKey(int roleId) {
        Role key = new Role();
        key.setRoleId(roleId);
        int rows = getSqlMapClientTemplate().delete("S_ROLE.deleteByPrimaryKey", key);
        return rows;
    }
}